package maosui.websocket;

import java.util.HashMap;

/**
 * Created by wdj on 14-8-7.
 */
public class RequestParams{
    HashMap<String,String> params;

    public RequestParams(String queryString){
        params = Utils.parseString(queryString);
    }

    public String getString(String key){
        if(params == null)return null;
        return params.get(key);
    }

    public int getInt(String key){
        if(params == null || params.get(key) == null)return 0;
        return Integer.parseInt(params.get(key));
    }

    public boolean getBoolean(String key){
        if(params == null && params.get(key) == null)return false;
        return params.get(key).toLowerCase().equals("true");
    }

    public char getChar(String key){
        if(params == null && params.get(key) == null)return 0;
        return params.get(key).charAt(0);
    }
}